layui.use(['table','jquery','form','layer'], function(){
  var table = layui.table;
  var $ = layui.jquery;
  var form=layui.form;
  var layer = layui.layer;
  
    //监听提交,添加事件
    form.on('submit(btn_update)', function(data){
      var field = data.field; //获取提交的字段
      var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引  
			var id=$("#id").val();
	    	var name=$("#sysname").val();
			var chinesename=$("#chinesename").val();
			var navurl=$("#navurl").val();
			var param = "?id=" + id + "&name=" +name + "&chinesename=" +chinesename  +"&navurl="+navurl;
			//alert(param)
			$.ajax({
				type:"get",
				url:urlapi+"systemmodel/addsystemmodeltwo" + param,
				xhrFields: {
					withCredentials: true
				},
				crossDomain: true,
				data:null,
				dataType : "json",
				success:function(date){
					if(date.code == 0){
						layer.msg(date.msg,{icon:6}); 
					}else{
						layer.msg(date.msg,{icon:5});
					}
					setTimeout(function(){
						parent.layui.table.reload('LAY-app-content-list'); //重载表格
     					parent.layer.close(index); //再执行关闭 
						parent.layui.table.reload('SystemModelTow'); //重载表格
					},1*1000)
				},
				error:function(date){
					layer.msg(date.msg,{icon:5});
				}
			})
      	return false;
    });
});